from manim import *

class AudioIntegrationExample(Scene):
    def construct(self):
        # Add background music
        self.add_sound(r"demo\2.mp3", time_offset=0)

        # Text element
        text = Text("Welcome to Manim!", font_size=72)
        self.play(Write(text))
        
        # Wait for the duration of the text display
        # 等待声音
        self.wait(28)
        
        # Transition to another text
        self.play(FadeOut(text))
        new_text = Text("Let's add some audio!", font_size=72)
        self.play(Write(new_text))
        